Contents | Index | < Browse | Browse >

LETTERscanfULETTER Reads formatted data from the standard input.

Overview
#include <stdio.h>

r = scanf(format, ...);

int r; const char *format;

Portability
ANSI

Description
This function reads characters from the standard input stream and interprets them according to the input format template. You need to specify additional variable pointers which will be used by the function in sequence to store the read data.

An error during reading (eg. if the data read could be not used accordingly to the input format template) can be detected by checking if the return value is smaller than the number of variable pointers passed.

Returns
The number of data (strings, numbers etc.) read.

See also
fscanf , sscanf